#include "uart_putchar.h"

unsigned long __attribute__((weak)) CONFREG_UART_BASE = 0xbfafff10;
unsigned long __attribute__((weak)) UART_BASE = 0xbfe001e0;

void simu_putchar(char c)
{
    *( volatile char * ) ( CONFREG_UART_BASE ) = c;
}

void uart_putchar(char c)
{
	while (!((*( volatile char * ) ( UART_BASE + 0x5 )) & 0x20));
    *( volatile char * ) ( UART_BASE ) = c;
}

char uart_getchar(void)
{
	char data;
	while (!((*( volatile char * ) ( UART_BASE + 0x5 )) & 0x1));
    data = *((volatile unsigned char *)(UART_BASE));
	return data;
}
